package com.atguigu.boot2.controller;

import com.atguigu.boot2.bean.Car;
import com.atguigu.boot2.bean.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 杨林
 * @create 2023-08-21 9:38 星期一
 * description:
 */
@RestController
public class Hello {
    
    @Autowired
    private Car car;
    
    @GetMapping("/hello")
    public String hello(@RequestParam("name") String name){
        return "<center><h1>hello " + name +  "</h1></center>";
    }
    
    
    @GetMapping("/car")
    public Car car(){
        return car;
    }

    
    @Autowired
    private Person person;
    
    /**
     * 测试yaml绑定属性
     * @return
     */
    @GetMapping("/yaml")
    public Person getPerson(){
        return person;
    }
}
